package com.ruoyi.moon.service.impl;

import java.util.List;

import com.github.houbb.sensitive.word.core.SensitiveWordHelper;
import com.ruoyi.common.annotation.EventTracking;
import com.ruoyi.common.config.MySensitiveWordReplace;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.moon.domain.vo.MyReplyVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.moon.mapper.MoonReplyMapper;
import com.ruoyi.moon.domain.MoonReply;
import com.ruoyi.moon.service.IMoonReplyService;

/**
 * 回复Service业务层处理
 * 
 * @author admin
 * @date 2024-11-06
 */
@Service
public class MoonReplyServiceImpl implements IMoonReplyService 
{
    @Autowired
    private MoonReplyMapper moonReplyMapper;

    /**
     * 查询回复
     * 
     * @param id 回复主键
     * @return 回复
     */
    @Override
    public MoonReply selectMoonReplyById(Long id)
    {
        return moonReplyMapper.selectMoonReplyById(id);
    }

    /**
     * 查询回复列表
     * 
     * @param moonReply 回复
     * @return 回复
     */
    @Override
    public List<MoonReply> selectMoonReplyList(MoonReply moonReply)
    {

        return moonReplyMapper.selectMoonReplyList(moonReply);
    }

    /**
     * 新增回复
     * 
     * @param moonReply 回复
     * @return 结果
     */
    @Override
    public int insertMoonReply(MoonReply moonReply)
    {
        String replace = SensitiveWordHelper.replace(moonReply.getContent(), new MySensitiveWordReplace());
        moonReply.setContent(replace);
        moonReply.setCreateTime(DateUtils.getNowDate());
        return moonReplyMapper.insertMoonReply(moonReply);
    }

    /**
     * 修改回复
     * 
     * @param moonReply 回复
     * @return 结果
     */
    @Override
    public int updateMoonReply(MoonReply moonReply)
    {
        return moonReplyMapper.updateMoonReply(moonReply);
    }

    /**
     * 批量删除回复
     * 
     * @param ids 需要删除的回复主键
     * @return 结果
     */
    @Override
    public int deleteMoonReplyByIds(Long[] ids)
    {
        return moonReplyMapper.deleteMoonReplyByIds(ids);
    }

    /**
     * 删除回复信息
     * 
     * @param id 回复主键
     * @return 结果
     */
    @Override
    public int deleteMoonReplyById(Long id)
    {
        return moonReplyMapper.deleteMoonReplyById(id);
    }

    @Override
    public List<MyReplyVO> selectMoonRestore(Long userId) {
        return moonReplyMapper.selectMoonRestore(userId);
    }


}
